package cn.itsource.controller.manager;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.itsource.api.LoginRemoteApi;
import cn.itsource.constants.ErrorCode;
import cn.itsource.mapper.LoginMapper;
import cn.itsource.pojo.domain.Login;
import cn.itsource.result.JSONResult;
/*import io.seata.spring.annotation.GlobalTransactional;*/
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "登录表",description = "登录表")
@RestController
public class RegisterController implements LoginRemoteApi {
    @Autowired
    private LoginMapper loginMapper;

    @Operation( summary= "注册",description = "基础对象保存接口")
    @Parameter(name = "Register",description = "保存的对象",required = true)
    @SaIgnore
    @Override
/*    @GlobalTransactional*/
    public JSONResult create(Login login) {

        int insert = loginMapper.insert(login);

        if (insert==1){
            return JSONResult.success();
        }
        return JSONResult.error(ErrorCode.NO_REGISTER);
    }
}
